import request from '@/util/request.js'

//查询客户信息
export const workCustomListService =()=>{
    return request.get('/user/selectAll')
}

//添加客户
export const workCustomAddService = (customData)=>{
    return request.post('/user/insert',customData)
}

//修改客户信息
export const workCustomUpdateService = (customData)=>{
    return request.put('/user/update',customData)
}

//删除客户信息
export const workCustomDeleteService = (userId)=>{
    return request.delete('/user/delete?userId='+userId)
}

//条件查询客户信息
export const workCustomSearchService = (params) => {
  return request.get('/user/selectNeed?',{params: params});
}

//导出客户信息
export const exportUserExcelService = () => {
  return request.get('/user/export',
    {responseType: 'blob'} //指定响应类型为文件流，用于导出
  )
};

//导入客户信息
export const importUserExcelService = (file) => {
  const formData = new FormData();
  formData.append('file', file); // 文件对象
  return request.post('/user/input', formData, {
    headers: {
      'Content-Type':'multipart/form-data' //设置文件上传格式
    }
  })
};

//查询员工信息
export const workEmployeeListService = ()=>{
  return request.get('/employee/selectAll')
}

//添加员工信息
export const workEmployeeAddService = (employeeData)=>{
  return request.post('/employee/insert',employeeData)
}

//修改员工信息
export const workEmployeeUpdateService = (employeeData)=>{
  return request.put('employee/update',employeeData)
}

//删除员工信息
export const workEmployeeDeleteService = (emId)=>{
  return request.delete('employee/delete?emId=' + emId)
}

//条件查询员工
export const workEmployeeSearchService = (params)=>{
  return request.get('/employee/selectNeed?',{params:params})
}

//查询业务
export const workServicesListService = ()=>{
  return request.get('/services/selectAll')
}

//添加业务
export const workServicesAddService = (servicesData)=>{
  return request.post('/services/insert',servicesData)
}

//删除业务
export const workServicesDeleteService = (serId)=>{
  return request.delete('/services/delete?serId=' + serId)
}

//修改业务
export const workServicesUpdateService = (servicesData)=>{
  return request.put('/services/update',servicesData)
}

//条件查询业务
export const workServicesSearchService = (params)=>{
  return request.get('/services/selectNeed',{params:params})
}

//导出业务信息
export const exportServicesExcelService = (userId)=>{
  return request.get('/services/export',{responseType: 'blob', params:{userId}})
}

//导入业务信息
export const importServicesExcelService = (file)=>{
  const formData = new FormData();
  formData.append('file',file);
  return request.post('/services/input', formData, {
    headers:{
      'Content-Type': 'multipart/form-data'
    }
  })
}

//查询工单
export const workOrderListService = ()=>{
  return request.get('/order/selectAll')
}

//创建工单
export const workOrderAddService = (orderData)=>{
  return request.post('/order/insert',orderData)
}

//退单
export const workOrderDeleteService = (orderId)=>{
  return request.delete('/order/delete?orderId=' + orderId)
}

//修改工单
export const workOrderUpdateService = (orderData)=>{
  return request.put('/order/update',orderData)
}

//条件查询工单
export const workOrderSearchService = (params)=>{
  return request.get('/order/selectNeed',{params:params})
}